<%--
  Created by IntelliJ IDEA.
  User: Zhj
  Date: 2024/4/5
  Time: 0:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>AddMessage Page</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="/static/layui/css/layui.css" rel="stylesheet">
    <link href="/static/css/AddMessage.css" rel="stylesheet">
    <script src="/static/layui/js/layui.js"></script>
</head>

<body>
<div class="addlist">
    <div class="layui-card-header">
        <h1 style="text-align: center;">我要留言</h1>
    </div>
    <form class="layui-form" action="/AddMessage" method="post">
        <div class="layui-form-item">
            <div class="layui-input-group">
                <div class="layui-input-split layui-input-prefix">
                    标题
                </div>
                <input type="text" name="mtitle" placeholder="请输入留言标题" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-group">
                <div class="layui-input-split layui-input-prefix">
                    类型
                </div>
                <div class="select layui-form" title="请选择类型">
                    <select id="mtype" name="mtype">
                        <option value="请选择留言类型" disabled>请选择留言类型</option>
                        <option value="科技">科技</option>
                        <option value="咨询">咨询</option>
                        <option value="教育">教育</option>
                        <option value="娱乐">娱乐</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-group">
                <div class="layui-input-split layui-input-prefix">
                    作者
                </div>
                <input type="text" name="id" value="<%=session.getAttribute("username")%>" disabled class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-group">
                <div class="layui-input-split layui-input-prefix">
                    内容
                </div>
                <textarea name="mcontent" autoHeight="true" placeholder="请输入留言内容.........." class="layui-textarea"></textarea>
            </div>
        </div>
<%--        按钮css样式在外链式找不到--%>
        <div class="layui-form-itemb sumbitBtn" style="text-align: center;">
            <input style="width: 20%;" type="submit" value="提交" class="layui-btn layui-btn-fluid" lay-submit lay-filter="demo-login" style="margin: 0 auto;">
        </div>
    </form>
</div>


</body>
<script>
    layui.use('form', function() {
        var form = layui.form;
        form.render();
    });
    $(function() {
        $.fn.autoHeight = function() {
            function autoHeight(elem) {
                elem.style.height = 'auto';
                elem.scrollTop = 0; //防抖动
                elem.style.height = elem.scrollHeight + 'px';
            }
            this.each(function() {
                autoHeight(this);
                $(this).on('keyup', function() {
                    autoHeight(this);
                });
            });
        }
        $('textarea[autoHeight]').autoHeight();
    })
</script>

</html>
